package com.ddpyjqtd.singleton;

import java.io.IOException;
import java.util.concurrent.CountDownLatch;

/**
 * @Description: 单例的唯一性测试
 * 
 * @author: ddpyjqtd
 * @Date: 2019年3月9日
 *
 */
public class SingletonUniquTest {

	private static final int THREAD_COUNT = 1000;

	public static void main(String[] args) throws InterruptedException, IOException {
		final CountDownLatch countDownLatch = new CountDownLatch(THREAD_COUNT);
		for (int i = 0; i < THREAD_COUNT; i++) {
			new Thread() {
				@Override
				public void run() {
					try {
						countDownLatch.await();
						System.out.println(System.currentTimeMillis() + ".." + StaticInnerClass.getInstance());
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
				}
			}.start();
			countDownLatch.countDown();
		}
		
		Thread.sleep(3000);
	}

}
